<template>
	<view class="container">
		<view class="list-cell b-b" hover-class="cell-hover" :hover-stay-time="50" v-for="(item, index) in pageList"
			:key="index" :class="{'m-t': index === 0}" @click="onPageDetail(item.id)">
			<text class="cell-tit">{{item.name}}</text>
			<text class="cell-more iconfont icon-more"></text>
		</view>
		<view class="list-cell m-t" v-if="appVersion">
			<text class="cell-tit">当前版本</text>
			<text class="cell-tip">{{appVersion}}</text>
		</view>
		<view class="list-cell b-feedback" @click="onFeedback"><text class="cell-tit">意见反馈</text></view>
	</view>
</template>

<script>
	import {
		getPageList
	} from '@/service/api/content.js'
	import mixinsCommon from '@/mixins/common.js'
	export default {
		mixins: [mixinsCommon],
		data() {
			return {
				pageList: []
			}
		},
		onLoad() {
			getPageList('setting').then(([err, res]) => {
				console.log('getPageList', err, res)
				if (!err) {
					this.pageList = res
				}
			})
		},
		computed: {
			appVersion() {
				return this.$store.getters.globalConfig.app_version || ''
			}
		},
		methods: {
			onPageDetail(id) {
				uni.navigateTo({
					url: '/pages/content/page_detail?id=' + id
				})
			},
			onFeedback() {
				uni.navigateTo({
					url: '/pages/user/feedback'
				})
			}
		}
	};
</script>

<style lang="scss">
	page {
		background: $page-color-base;
	}

	.list-cell {
		display: flex;
		align-items: baseline;
		padding: 20upx $page-row-spacing;
		line-height: 60upx;
		position: relative;
		background: #fff;
		justify-content: center;

		&.b-feedback {
			margin-top: 40upx;

			.cell-tit {
				color: $uni-color-primary;
				text-align: center;
				margin-right: 0;
			}
		}

		&.cell-hover {
			background: #fafafa;
		}

		&.b-b:after {
			left: 30upx;
		}

		&.m-t {
			margin-top: 16upx;
		}

		.cell-more {
			align-self: baseline;
			font-size: $font-lg;
			color: $font-color-light;
			margin-left: 10upx;
		}

		.cell-tit {
			flex: 1;
			font-size: $font-base + 2upx;
			color: $font-color-dark;
			margin-right: 10upx;
		}

		.cell-tip {
			font-size: $font-base;
			color: $font-color-light;
		}
	}
</style>
